#!/usr/bin/perl

if ($#ARGV != -1) {
   exit print "Usage: ctihave\n" ;
}

$tool = $ENV{"DTOOL"} ;
if ( $tool eq "" ) {
   die "not configured for using CTtools\n" ;
}

require "$tool/built/include/ctutils.pl" ;
require "$tool/built/include/ctvspec.pl" ;
require "$tool/built/include/ctquery.pl" ;
require "$tool/built/include/ctproj.pl" ;
require "$tool/built/include/ctcm.pl" ;

$projs = $ENV{"CTPROJS"} ;
@projsplit = split( / +/, $projs ) ;

foreach $item ( @projsplit ) {
    @items = split( /:/, $item ) ;
    $thisproj = $items[0] ;
    $thisflav = $items[1] ;
    $thisspec = &CTResolveSpec( $thisproj, $thisflav ) ;
    $result = $result . &CTCMIHave( $thisproj, $thisflav, $thisspec ) ;
}
if ( $result ne "" ) {
    @splitlist = split( /\n/, $result ) ;
    foreach $item ( @splitlist ) {
	print $item . "\n" ;
    }
}
